<template>
  <div>
    <el-button size="mini" type="text"  @click="to">修改</el-button>
    <eForm ref="form" :sup_this="sup_this" :is-add="false"/>
  </div>
</template>
<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    data: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    }
  },
  methods: {
    to() {
      const _this = this.$refs.form
      this.data.arriveTime = this.data.arriveTime==null?this.data.arriveTime:new Date(this.data.arriveTime);
      this.data.finishTime = this.data.finishTime==null?this.data.finishTim:new Date(this.data.finishTime);
      _this.fileList = []
      _this.form = {
        id: this.data.id,
        taskTitle: this.data.taskTitle,
        taskContent: this.data.taskContent,
        taskAddr: this.data.taskAddr,
        attachments: this.data.attachments,
        arriveTime: this.data.arriveTime,
        finishTime: this.data.finishTime,
        notes: this.data.notes,
        linker: this.data.linker,
        cellphone: this.data.cellphone,
        inputOperator: this.data.inputOperator,
        inputTime: this.data.inputTime
      }
      this.data.attachments.split(',').forEach(function(data, index) {
        if(data!=null && data!=''){
          _this.fileList.push({name:data,url:'http://localhost:8000/api/picture/'+data})
        }
      }),
      _this.dialog = true
    }
  }
}
</script>

<style scoped>
  div{
    display: inline-block;
    margin-right: 3px;
  }
</style>
